<template>
    <div>detail
        <div  v-if="flag">
            name:{{item.name}}
            <img :src="item.image" />
        </div>
    </div>
</template>
<script>
import {mapState} from 'vuex';
export default {
  computed:{
      ...mapState(['list'])
  },
  data(){
return {
    item:{},
    flag:false
}
  },
  created(){
    console.log('this.list',this.list);
    this.list.forEach(item => {
        if(item.id+""===this.$route.params.id+""){
            this.item=item;
            console.log('this.item',this.item);
            this.flag=true;
        }
    });

  },
  
}
</script>